home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1985 May
/
1985-05.d64
/
jog log_vic
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
134 lines
10 cl$=chr$(147):r$=chr$(18):rf$=chr$(146):d1$=chr$(17):u1$=chr$(145):q$=","
15 cr$=chr$(13)
20 u3$=u1$+u1$+u1$:d2$=d1$+d1$:om$="(eq,ne,gt,lt,ge,le)":m$="camdsx"
30 printcl$tab(5)d2$r$"jogger's log"rf$d1$:input"max # of runs ";rm
40 dimdm%(12),c$(5,2),tb%(2,rm),n%(5),op$(5),vl$(5),d$(5)
50 fori=1to12:readdm%(i):next
60 forj=1to2:fori=1to5:readc$(i,j):nexti:nextj
70 gosub120:onmgoto690,750,790,850,910,200:goto70
80 print"can't do past";r:fori=1to2500:next:goto70
90 input#15,a,b$,c,d:ifa=0thenreturn
100 printd2$"error on disk":printa;b$;c;d:goto200
110 rem main menu
120 b$="":print"[147] c[146] create a file":print" a[146] add a record"
130 print" m[146] modify a record":print" d[146] delete a record"
140 print" s[146] show a record":print" x[146] exit"
150 input" ";b$:form=1to6:ifb$<>mid$(m$,m,1)thennext
160 return
170 rem misc subroutines
180 b$="y":printtab(14)b$u1$:input"another(y/n)";b$:printcl$:return
190 input"name ";f$:input"run# ";p:close15:open15,8,15:gosub270:return
200 close1:close2:close15:end
210 input"name ";f$:close15:close2:open15,8,15:open2,8,2,"#":gosub270:return
220 forz=1to5:print"#";z;r$c$(z,1)rf$" "d$(z)d1$:nextz:return
230 printd1$r$"cr"rf$" to continue":inputb$:printcl$:return
240 printd2$r$c$(z,1)rf$,c$(z,2):inputd$(z):return
250 rem disk subroutines
260 rem get index file
270 open1,8,0,"0:"+f$+".indx,s,r":gosub90
280 forn=1to600:input#1,tb%(1,n),tb%(2,n):ifst>64thenr=n-1:close1:return
290 ifn>rmthenprint"increase max run#":goto200
300 nextn
310 rem save index file
320 open1,8,1,"@0:"+f$+".indx,s,w":gosub90
330 forn=1tor:print#1,tb%(1,n)cr$tb%(2,n):gosub90:nextn:close1:close15:return
340 rem find next free track & block
350 t=1:b=1
360 print#15,"b-a:"0;t;b:input#15,a,b$,c,d:ifa=65thent=c:b=d:goto360
370 tb%(1,p)=t:tb%(2,p)=b
380 rem write run# p
390 print#2,d$(1)q$d$(2)q$d$(3)q$d$(4)q$d$(5)
395 print#15,"b-w:"2;0;tb%(1,p);tb%(2,p):return
400 rem read run# p
410 t=tb%(1,p):b=tb%(2,p):print#15,"b-r:"2;0;t;b
420 input#2,d$(1),d$(2),d$(3),d$(4),d$(5):return
430 rem end disk subroutines
440 rem selection
450 printcl$d1$r$"selection criteria"rf$:printd2$"enter #,option,value"d2$
460 forx=1to5
470 forz=1to5:print"#";z;"is for ";c$(z,1):nextz
480 printtab(5)d2$"options =":printom$d1$:n%(x)=0:inputn%(x),op$(x),vl$(x):printcl$
490 ifn%(x)=0thenx=x-1:return
500 nextx:return
510 rem calc pace
520 mi=val(mid$(tm$,1,2))*60+val(mid$(tm$,3,2))
530 mi=mi+val(mid$(tm$,5,2))/60:printds$"mi";
540 pa=mi/val(ds$):pm=int(pa):ps=int((pa-pm)*60):tm$=str$(pm):a=len(tm$):b$=str$(ps)
550 d=len(b$):ds$="":ifd=2thends$="0"
560 print"..."mid$(tm$,2,a-1)":"ds$mid$(b$,2,d-1)" pace":return
570 rem calc day#
580 u=val(left$(dy$,2)):ifu<1oru>12thenprintt"bad month";dy$:goto200
590 da=dm%(u)+val(right$(dy$,2))*365+val(mid$(dy$,3,2)):return
600 rem keep him honest
610 forz=1to3step2:iflen(d$(z))<>6thenprintd$(z):goto200
620 nextz:return
630 rem data base subroutines
640 rem data entry
650 printcl$"enter data on run#";p
660 forz=1to5:d$(z)="":gosub240:nextz
670 gosub610:gosub350:return
680 rem create a file
690 input" name ";f$:open15,8,2,f$+".indx,s,r":open11,8,15:input#11,a$,b$,c$
700 ifb$<>"file not found"thenprintf$" already exists":close11:close15:goto690
710 close11:close15:open15,8,15:open2,8,2,"#"
720 forp=1torm:gosub650:gosub180:ifb$="y"thennextp
730 r=p:gosub320:close2:goto70
740 rem add an entry
750 gosub210:ifr+1>rmthen80
760 r=r+1:p=r:gosub650
770 gosub320:close2:goto70
780 rem modify run# p
790 gosub190:close2:open2,8,2,"#":ifp>rthen80
800 gosub410:print"[147]":gosub220
810 z=0:input"modify #";z:ifz=0thengosub610:gosub390:close2:close15:goto70
820 ifz>=6thenprint"bad #":goto810
830 gosub240:goto810
840 rem delete an entry
850 gosub190:ifp>rthen80
860 print#15,"b-f:"0;tb%(1,p);tb%(2,p)
870 if p<rthen forz=p+1tor:tb%(1,z-1)=tb%(1,z):tb%(2,z-1)=tb%(2,z):nextz
880 r=r-1:gosub320:close2:goto70
890 rem analysis subroutines
900 rem show results
910 gosub210:gosub450
920 wm=0:wt=0:bg=0:printd2$"enter 1-list",tab(6)"2-pace",tab(6)"3-plot"
930 inputtx:printcl$:iftx<>3then950
940 printcl$"one *=how many miles":inputsc:sc=1/sc
950 forp=1tor:gosub410:c=0:ifx=0then1060
960 rem logical selection
970 forw=1tox:n=n%(w)
980 ifop$(w)="eq"thenifd$(n)=vl$(w)thenc=c+1:goto1040
990 ifop$(w)="ne"thenifd$(n)<>vl$(w)thenc=c+1:goto1040
1000 ifop$(w)="lt"thenifd$(n)<vl$(w)thenc=c+1:goto1040
1010 ifop$(w)="gt"thenifd$(n)>vl$(w)thenc=c+1:goto1040
1020 ifop$(w)="le"thenifd$(n)<=vl$(w)thenc=c+1:goto1040
1030 ifop$(w)="ge"thenifd$(n)>=vl$(w)thenc=c+1:goto1040
1040 nextw
1050 ifc<>xthen1250
1060 ontxgoto1080,1110,1170
1070 rem list
1080 print" "r$"run#"rf$;p;d1$:gosub220:printd2$d1$:gosub230
1090 goto1250
1100 rem pace
1110 dy$=d$(1):gosub580:ifbg=0thenbg=da
1120 tm$=d$(3):ds$=d$(2):gosub520:wm=wm+mi/pa:wt=wt+mi
1130 ifda>=bg+6thenbg=bg+7:ds$=str$(wm):mi=wt:printr$ds$"mi/wk"rf$;:gosub540:wm=0:wt=0
1140 ifwt=0thengosub230
1150 goto1250
1160 rem graph
1170 dy$=d$(1):gosub580:ifbg=0thenbg=da:e=0
1180 n0=da-bg:bg=da:ifn0<2then1200
1190 forz=2ton0:print"0":e=e+1:next
1200 ns=int(val(d$(2))*sc+.5):b$="*":ifns=1then1230
1210 ifns>23thenns=23
1220 forz=2tons:b$=b$+"*":nextz
1230 printb$:e=e+1:ife>15thene=0:gosub230
1240 ife=0thenforz=1to16:print" ";:next:print"[145][145]"
1250 nextp
1260 close1:close2:close15
1270 iftx<>1thengosub230
1280 goto 70
1290 data0,31,59,90,120,151,181,212,243,273,304,334
1300 datadate,distance,time,route,comments,(mmddyy),(miles),(hhmmss)
1310 data(< 88 chrs),(< 88 chrs)